package com.godyao.service;

import com.godyao.dao.UserDao;
import com.godyao.framework.beans.factory.DisposableBean;
import com.godyao.framework.beans.factory.InitializingBean;


public class UserService implements InitializingBean, DisposableBean {
    private UserDao userDao;

    private Integer count;

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    // 测试BeanFactoryPostProcessor
    private String location;

    private String company;

    public UserService(Integer count) {
        this.count = count;
    }


    public UserService() {

    }

    public String getUser(int id) {
        return userDao.getUserById(id);
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("userService执行DisposableBean.destroy()");
    }

    @Override
    public void afterPropertiesSet() {
        System.out.println("userService执行InitializingBean.afterPropertiesSet()");
    }
}
